package com.yanqu.road.server.cmd;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.ActivityProto;
import com.yanqu.road.pb.union.UnionActivityGroupProto;
import com.yanqu.road.utils.YanQuMessageUtils;
import io.netty.channel.ChannelHandlerContext;

public abstract class CrossAppointCommand extends CrossCommand {

    protected int groupId;

    @Override
    public void execute(ChannelHandlerContext ctx, YanQuMessage basePacket) throws Exception {
        // 解析指定跨服协议
        ActivityProto.AgentTransferToAppointCrossMsg baseMsg = ActivityProto.AgentTransferToAppointCrossMsg.parseFrom(basePacket.getBytes());
        YanQuMessage packet = YanQuMessageUtils.buildMessageByte(baseMsg.getCode(), baseMsg.getMsg().toByteArray());
        packet.setPlayerId(basePacket.getPlayerId());
        if(baseMsg.hasGroupId()){
            groupId = baseMsg.getGroupId();
        }
        super.execute(ctx, packet);
    }

}
